<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Vue实例添加全局函数</title>
</head>
<body>
<script src="https://unpkg.com/vue@3.5.3/dist/vue.global.prod.js"></script>
<div id="app">
    {{ $t(message) }}
</div>
<script>
    const {createApp, ref} = Vue;
    var app = createApp({
        setup() {
            const message = ref("hello");
            return {
                message,
            };
        },
    });
    app.config.globalProperties.$t = (s) => s + "_ok"
    app.mount("#app");
</script>
</body>
</html>
